<?php

namespace app\admin\controller;


use app\common\service\UserToken;
use think\Cache;

class WxStatistics extends BaseController {
    public function index() {
        validate('WxStatistics')->goCheck();
        $accessToken = (new UserToken())->getAccessToken();
        $query       = input('get.');
        $url         = config('wx.statistics_url') . 'getweanalysisappid' . $query['type'] . '?access_token=' . $accessToken;
        $result      = curl_post($url, [
            "begin_date" => $query['begin_date'],
            "end_date"   => $query['end_date']
        ]);
        if (empty($result)) {
            return show(config('code.fail'), '获取微信数据失败');
        }
        return show(config('code.success'), '获取微信数据成功', json_decode($result, true));
    }
}